package com.softstao.guoyu.mvp.interactor.shop;

import com.softstao.guoyu.global.APIInterface;
import com.softstao.guoyu.model.shop.CartList;
import com.softstao.guoyu.mvp.interactor.BaseInteractor;
import com.softstao.guoyu.utils.MyHttpParams;

import rx.functions.Action1;

/**
 * Created by vaikus on 2017/7/21.
 */

public class CartInteractor extends BaseInteractor {
    public void getCartList(int agentId, Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId",agentId);
        builder.setAction(action1)
                .setUrl(APIInterface.CART_LIST)
                .setType(CartList.class)
                .getVolley()
                .post(params);
    }

    public void addCart(int agentId,String productInfo,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId",agentId,"productInfo",productInfo);
        builder.setAction(action1)
                .setUrl(APIInterface.ADD_CART)
                .setType(null)
                .getVolley()
                .post(params);
    }

    public void updateCartList(int agentId,String productInfo,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId",agentId,"productInfo",productInfo);
        builder.setAction(action1)
                .setUrl(APIInterface.UPDATE_CART_LIST)
                .setType(CartList.class)
                .getVolley()
                .post(params);
    }
}
